package com.zlp.mall.portal.modules.oms.mapper;

import com.baomidou.mybatisplus.core.conditions.Wrapper;
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.baomidou.mybatisplus.core.toolkit.Constants;
import com.zlp.mall.portal.modules.oms.dto.resp.CarItemResp;
import com.zlp.mall.portal.modules.oms.model.CartItem;
import org.apache.ibatis.annotations.Param;
import org.apache.ibatis.annotations.Select;

import java.util.List;

/**
 * <p>
 * 购物车表 Mapper 接口
 * </p>
 *
 * @author ZouLiPing
 * @since 2021-10-15
 */
public interface CartItemMapper extends BaseMapper<CartItem> {

    @Select("SELECT sum(quantity) FROM oms_cart_item WHERE delete_status=1 AND (member_id = #{memberId}) ")
    Integer getCartSum(@Param(value = "memberId") Long memberId);


    List<CarItemResp> cartList(@Param(Constants.WRAPPER) Wrapper ew);
}
